/*
 * @lc app=leetcode.cn id=179 lang=cpp
 *
 * [179] 最大数
 */

// @lc code=start
#include<map>
#include<algorithm>
#include<string>
#include<vector>
#include<iostream>
class Solution 
{
public:
    
    
    string largestNumber(vector<int>& nums)
     {
       std::string ans;
       std::vector<std::string> arr;
       for(int i=0;i<nums.size();i++)
       {
            arr.push_back(std::to_string(nums[i]));
       }
       //for(auto&ch:arr)std::cout<<ch<<" ";
       //表达式为真代表谁在前面
       std::sort(arr.begin(),arr.end(),[](const std::string &s1,const std::string &s2)
       {
            return s1+s2>s2+s1;
       });
        for(auto&ch:arr)
        {
            ans+=ch;
        }
        if(ans[0]=='0') return "0";
        return ans;


    }
};
// @lc code=end

